<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>挂靠公司详细信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<!-- 是否显示三方数据页签 -->
<sys:funcAuth resCd="ThreeData">
    <span id="isShowThreeDataPage" />
</sys:funcAuth>
<sys:funcAuth resCd="lnkPrjArPage">
    <span id="isShowPrjArPage" />
</sys:funcAuth>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <div id="pageInTab" class="pageInTab">
            <div tabid="tabA" title="详细信息" lselected="true">
                <form id="formSet1">
                    <div class="fieldset1 tabel_col clearFix">
                        <div class="caption">
                            <span class="title">详细信息</span>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">公司名称</div>
                            <div class="field">
                                <span id="lnkCompNm" name="lnkCompNm">&nbsp;</span>
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                        <div class="label">组织机构代码</div>
                        <div class="field">
                         <span id="orgCode" name="orgCode">&nbsp;</span>
                        </div>
                    </div> -->
                        <div class="fieldBox col_33">
                            <div class="label">社会统一信用代码</div>
                            <div class="field">
                                <span id="succ" name="succ">&nbsp;</span>
                            </div>
                        </div>
                        <c:if test="${isCheck == 1}">
                            <div class="fieldBox col_33">
                                <div class="label">信息录入方式</div>
                                <div class="field">
                                    <span id="dataFromNm" name="dataFromNm">&nbsp;</span>
                                </div>
                            </div>
                        </c:if>
                        <div class="fieldBox col_33">
                            <div class="label">公司归属</div>
                            <div class="field">
                                <span id="ownerCdNm" name="ownerCd">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">所在地</div>
                            <div class="field">
                                <span id="officeAddr" name="officeAddr">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">主营项目类别</div>
                            <div class="field">
                                <span id="majorBiz" name="majorBiz">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">企业类型</div>
                            <div class="field">
                                <span id="compTyp" name="compTyp">&nbsp;</span>
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                         <div class="label">营业执照注册号</div>
                         <div class="field">
                             <span id="bizLicNo" name="bizLicNo">&nbsp;</span>
                         </div>
                     </div> -->
                        <div class="fieldBox col_100">
                            <div class="label">注册地址</div>
                            <div class="field">
                                <a href="javascript:toRegAddrList()" class="sq-button-hasicon link">
                                    <i class="sqBtnIco_1"></i>
                                    <span name="regAddr" id="regAddr">&nbsp;</span>
                                </a>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">成立日期</div>
                            <div class="field">
                                <span id="regDt" name="regDt">&nbsp;</span>
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                         <div class="label">税务登记号</div>
                         <div class="field">
                             <span id="taxRegNo" name="taxRegNo">&nbsp;</span>
                         </div>
                     </div> -->
                        <div class="fieldBox col_33">
                            <div class="label">道路运输许可证有效期</div>
                            <div class="field">
                                <span id="expDt" name="expDt">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">经营范围</div>
                            <div class="field">
                                <span id="bizScope" name="bizScope">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">法人代表</div>
                            <div class="field">
                                <span id="corpRep" name="corpRep">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">法人身份证号</div>
                            <div class="field">
                                <span id="idNo" name="idNo">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">现累计挂靠数量</div>
                            <div class="field">
                                <span id="totLnkQty" name="totLnkQty">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">自有车辆备案数量</div>
                            <div class="field">
                                <span id="ownQty" name="ownQty">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">在我司累积挂靠车辆</div>
                            <div class="field">
                                <span id="ourTotLnkQyt" name="ourTotLnkQyt">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">可支持挂靠项目类型</div>
                            <div class="field">
                                <span id="suppLnkPrjTypCd" name="suppLnkPrjTypCd">&nbsp;</span>
                            </div>
                        </div>
                        <c:if test="${isCheck != 1 }">
	                        <div class="fieldBox col_33">
	                            <div class="label">三方授权书是否上传</div>
	                            <div class="field">
	                                <span id="isUploadLoaNm" name="isUploadLoaNm">&nbsp;</span>
	                            </div>
	                        </div>
	                        <div class="fieldBox col_33">
	                            <div class="label">三方授权书是否回收</div>
	                            <div class="field">
	                                <span id="isRecycleLoaNm" name="isRecycleLoaNm">&nbsp;</span>
	                            </div>
	                        </div>
                        </c:if>
                        <c:if test="${isCheck == 1 }">
		                        <div class="fieldBox col_50">
								<div class="label">三方授权书是否提供</div>
								<div class="field">
			                        <select name="isUploadLoa" id="isUploadLoa" data-value=" " validate ="{required:true,select:true}">
			                        	<option value="2" checked >请选择</option>
			                        	<option value="1">是</option>
			                        	<option value="0">否</option>

									</select>
			                    </div>
							</div>
							<div class="fieldBox col_50">
								<div class="label">三方授权书是否回收</div>
								<div class="field">
			                        <select name="isRecycleLoa" id="isRecycleLoa" data-value=" " validate ="{required:true,select:true}">
			                        	<option value="2" checked >请选择</option>
			                        	<option value="1">是</option>
			                        	<option value="0">否</option>

									</select>
			                    </div>
							</div>
                        </c:if>
                        <div class="fieldBox col_33">
                            <div class="label">区域</div>
                            <div class="field">
                                <span name="rgnNms" id="rgnNms">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">实际控制人</div>
                            <div class="field">
                                <span id="actCtrlNm" name="actCtrlNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">实际控制人手机号码</div>
                            <div class="field">
                                <span id="actCtrlMp" name="actCtrlMp">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">联系人</div>
                            <div class="field">
                                <span id="lnkNm" name="lnkNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">联系人手机号码</div>
                            <div class="field">
                                <span id="lnkMp" name="lnkMp">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" rlPsnDiv="zk">
                            <div class="label">联系人职务</div>
                            <div class="field">
                                <span id="lnkPost" name="lnkPost">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">审核状态</div>
                            <div class="field">
                                <span id="audStsCdNm" name="audStsCdNm">&nbsp;</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">备注</div>
                            <div class="field">
                                <textarea name="rem" id="rem" rows="4" class="ui-textarea l-textarea" style="width:72%"
                                          value="" readonly="readonly">
                                </textarea>
                            </div>
                        </div>
                    </div>
                    <div class="fieldBox col_100" style="display:none;">
                        <div class="field">
                            <input name="lnkCompId" id="lnkCompId" type="text" class="ui-textbox" value="${id}">
                        </div>
                    </div>
                    <div class="fieldset1 tabel_col clearFix">
                        <div class="caption">
                            <span class="title">项目发起人信息</span>
                        </div>
                        <div class="fieldset1 tabel_col clearFix">
                            <div class="fieldBox col_33">
                                <div class="label">客户经理</div>
                                <div class="field">
                                    <span id="startPrjCstMgrNm" name="startPrjCstMgrNm">&nbsp;</span>
                                </div>
                            </div>
                            <div class="fieldBox col_33">
                                <div class="label">联系方式</div>
                                <div class="field">
                                    <span id="startPrjCstMgrTel" name="startPrjCstMgrTel">&nbsp;</span>
                                </div>
                            </div>
                            <div class="fieldBox col_33">
                                <div class="label">所属机构</div>
                                <div class="field">
                                    <span id="startPrjCstMgrOrgCdNm" name="startPrjCstMgrOrgCdNm">&nbsp;</span>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="fieldBox col_100" id="psnDiv" style="display:none">
                        <div class="sqPanel">
                            <div class="sqPanel_head inL">
                                <span>主要人员信息</span>
                            </div>
                            <br/>
                            <br/>
                            <div id="psnGrid">
                                <div id="ligergrid_psn" class="sq-grid"></div>
                            </div>
                        </div>
                    </div>
                    <div class="fieldset1 tabel_col tabel_col_s clearFix">
                        <div class="caption">
                            <span class="title">上传附件信息</span>
                        </div>
                        <div class="sqPanel_body">
                            <div id="lnkFileInfoCfgGrid" class="sq-grid"></div>
                        </div>
                        <%--<div class="fieldBox col_100" id="fileModify">
                            <div class="label">资料</div>
                            <div class="field">
                                <jsp:include page="../../system/sysUlFilesRec/sysUlFileRecListDetail.jsp" flush="true">
                                    <jsp:param name="pkId" value="${id}"/>
                                    <jsp:param name="tabNm" value="PRJ_LNK_COMP"/>
                                </jsp:include>
                            </div>
                        </div>--%>
                    </div>
                    <div id="btnsBox" class="btnsBox">
                        <c:if test="${isCheck == 1 }">
                            <span id="relationships" onclick="relationshipsView()"
                                  class="sq-button sq-button-round">集团关联图谱</span>
                             <span id = "addBtn" onclick="save()"  class="sq-button sq-button-round">保存</span>
                        </c:if>
                    </div>
                </form>
            </div>
            <div tabid="tabB" title="相关项目" id="tabBId">
                <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
            </div>
            <div tabid="tabC" title="变更记录" id="tabCId">
                <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
            </div>
            <div tabid="tabD" title="备案账号" id="tabDId">
                <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
            </div>
            <div tabid="tabE" title="人工干预" id="tabEId">
                <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
            </div>
            <div tabid="tabG" title="附件资料">
                <iframe src="" frameborder="0" name="tabG" id="tabG"></iframe>
            </div>

            <div tabid="tabF" title="三方数据">
                <iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
            </div>
            <div tabid="tabM" title="敞口统计">
                <iframe frameborder="0" name="tabM" id="tabM" src=""></iframe>
            </div>
            <!-- 17-8-9 by YAOXIURONG -->
            <!--      <div tabid="tabC" title="流程权限列表" id="tabCId" >
                      <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
                         </div> -->
        </div>
    </div>
</div>
</div>

<script type="text/javascript">
    var pageInApp = {
        flag: true
    };
    var rlPsnListPage;
    var buOrgCd = '${buOrgCd}';
    var id = '${id}'
    var rlPsnGrid;
    //if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_ZK){
    /*    if(buOrgCd==ProjectConstant.CODE_BU_ORG_CD_XNY){
            $("#psnDiv").hide();
        }else{ */
    $("#psnDiv").show();
    // }
    // }
    var pageInTab = null;
    var loadedTabs = []
    var lnkFileInfoCfgGrid = null;//挂靠公司资料配置明细

    var isCheckVerify = '${isCheckVerify}';

    var _cfgSysCd = '${cfgSysCd}'; //附件系统CODE
    var _cfgOrgCd = '${cfgOrgCd}'; //附件组织架构
    var _tabNm = '${tabNm}'; //附件对应表
    var _cfgCd = '${cfgCd}'; //附件CODE
    var _modulePath = '${modulePath}';
    var _costomerPath = '${costomerPath}';
    var _rootPath = '${rootPath}';
    var _uploadSysCd = '${uploadSysCd}';
	var isMask = '${isMask}';
	var isModify = '${isCheck}';
    $(function () {
        initData();
        initTab();
        if (buOrgCd != ProjectConstant.CODE_BU_ORG_CD_CAR) {
            //	pageInTab.removeTabItem("tabC");
            //pageInTab.removeTabItem("tabD");
            $("div[rlPsnDiv='zk']").each(function () {
                $(this).hide();
            });
        } else {
            $("div[rlPsnDiv='zk']").each(function () {
                $(this).hide();
            });

        }
        if ($("#rem") && $("#rem") != "undefined") {
            $("#rem").setDisabled_ligerTextarea(true);
        }
        if(isModify != 1){
       		if (liger.get("isUploadLoa")) {
            	liger.get("isUploadLoa").setDisabled(true);
        	}
       		if (liger.get("isRecycleLoa")) {
            	liger.get("isRecycleLoa").setDisabled(true);
        	}
        }
        $("#formSet1").ligerForm();
        lnkFileInfoCfgGrid = $("#lnkFileInfoCfgGrid").ligerGrid({
            url: '<%=path%>/project/prjlnkcomp/initLnkFileInfoList.do?pkId='+id+'&cfgCd='+_cfgCd +'&tabNm='+_tabNm +"&cfgSysCd="+_cfgSysCd+'&cfgOrgCd='+_cfgOrgCd+'&uploadSysCd='+_uploadSysCd,
            method: 'get',
            columns: [
                {display: '资料名称', name: 'datNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function (rowdata, rowindex, value) {
                        var mustSymbol = '<span class="requiredSymbol">*</span>';
                        if (rowdata.isMust == 1) {
                            return value + mustSymbol;
                        } else {
                            return value;
                        }
                    }
                },
                {display: '上传文件名称', name: 'fileNm',align: 'left', minWidth: 100, enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        if(value){
                            var h;
                            h='<a href="javascript:uploadFileByUrl(';
                            h+="'"+rowdata.filePath+"'";
                            h+=",'"+rowdata.fileNm+"'";
                            h+=')">'+rowdata.fileNm+'</a>'
                            return h;
                        }
                    }
                },
                {display: '上传文件路径', name: 'filePath',align: 'left', minWidth: 100,hide:true},
                {display: '上传文件明细', name: 'cfgDtlCd',align: 'left', minWidth: 100,hide:true},
                {display: '上传时间', name: 'crtTm',align: 'left', minWidth: 100, enabledSort: false,render:renderDate},
                {display: '状态', name: 'audStsCdNm', width: 100, enabledSort: false},
                {display: '操作', name: '', minWidth: 200,align: 'left',  enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        if(rowdata.audStsCd){
                            if(rowdata.audStsCd !=1){
                                if(!isCheckVerify || isCheckVerify != 1 ){
                                    /*if(rowdata.fileId) {
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }else{
                                        h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex +','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                                    }*/
                                }else{
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }else{
                                if (isCheckVerify && isCheckVerify == 1) {
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',1);"><i class="sqBtnIco_15"></i>验证通过</a>';
                                    h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="modifyAudStsCd(event,' + rowdata.fileId + ',2);"><i class="sqBtnIco_14"></i>验证不通过</a>';
                                }
                            }
                        }else{
                            //h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delUpLoadindFile(event,' + rowindex + ','+rowdata.cfgDtlCd+');"><i class="sqBtnIco_7"></i>删除</a>';
                        }
                        return h;
                    }
                },
                {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                    render:function(rowdata,rowindex,value){
                        var h='';
                        /*if(audStsCd && audStsCd != 1){
                            if(rowdata.fileId){
                                if(rowdata.audStsCd && rowdata.audStsCd !=1){
                                    h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                        ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                                }else if(!rowdata.audStsCd){
                                    h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                        ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                                }
                            }else{
                                h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',\''+rowdata.fileId+'\',\''+rowindex+'\')"></span>';
                            }
                        }*/
                        return h;
                    }
                },
            ],
            root: 'rows',
            hideLoadButton : true,
            width: '100%',
            height: '100%',
            isScroll: false,
            rownumbers:true,  //显示序号
            checkbox: false,
            allowUnSelectRow:true,
            alternatingRow: false,
            frozen: false,
            usePager: false,
            onAfterShowData: function ()
            {
                $('#lnkFileInfoCfgGrid').rowspan('datNm');
                $('#lnkFileInfoCfgGrid').rowspan('uploadNm');
            },
        });
    });

    function save(){
   	    //if(StringUtils.isEmpty(_splId)) return;
    	var _isUploadLoa = $("#isUploadLoa").val();
    	var _isRecycleLoa = $("#isRecycleLoa").val();
    	var _lnkId = $("#lnkCompId").val();
    	//console.log(_lnkId)
        var url = '<%=path%>/project/prjlnkcomp/saveLoa.do';
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType:'json',
            data:{id:_lnkId,isRecycleLoa:_isRecycleLoa,isUploadLoa:_isUploadLoa},
            url: url,
            beforeSend: function(){
                wait_dialog=top.$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
            },
            success:function(msg){
                wait_dialog.close();
                if(msg.success == 1){
                    top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
                    //回调刷新列表
                    var callback = GET_W2Wcallback();
                    callback();
                }else{
                    top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //修改资料的验证状态
    function modifyAudStsCd(event,_fileId,_audStsCd){
        var wait_dialog;
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {'fileId':_fileId,'audStsCd':_audStsCd},
            url: '<%=path%>/product/splInfo/modifyFileAudStsCd.do',
            beforeSend: function () {
                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            },
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    //$.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                    event.stopPropagation();
                    var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
                    liger.get(gridID).reload();
                }else{
                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    function uploadFileByUrl(_url,_name){
        if(SQ.regs.img.test(_name)){
            //SQ.imgPreview(_url);
            //SQ.imgPreview(_url, true);
            window.__ImgSrc = _url;
            window.__ImgTit = _name;
            window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
        }else{
            window.open(_url);
        }
    }

    //初始化数据
    function initData() {
        var lnkCompId = $("#lnkCompId").val();
        if (!lnkCompId) return;
        var _url = '<%=path%>/project/prjlnkcomp/getById.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {id: lnkCompId,isMask:isMask},
            url: _url,
            success: function (msg) {
                if (msg.success == 1) {
                    setData(msg.data);//设置数据
                    rlPsnListPage = msg.data.rlPsnListPage;
                    initRlPsnGrid();
                } else {
                    top.$.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                }
            }
        });
    }

    //初始化Tab
    function initTab() {
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            /*          onBeforeSelectTabItem: function (tabid) {
                         var lnkCompId = $("#lnkCompId").val();
                          if(tabid!="tabA"){
                                 if(pageInApp.flag){
                                    top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                                    return false;
                                }
                         }
                     }, */
            onAfterSelectTabItem: function (tabid) {
                //   if (loadedTabs.indexOf(tabid)<0) {
                var lnkCompId = $("#lnkCompId").val();
                if (tabid != "tabA") {
                    if (lnkCompId == null || lnkCompId == '') {
                        top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                        return false; //验证不通过，不执行以下代码
                    }
                }
                loadedTabs.push(tabid);
                switch (tabid) {
                    case "tabB":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjBscInfoListPage.do?lnkCompId=" + lnkCompId + "&&isLnkCompFlag=0" + "&isLnkPrjViewFlag=1");
                        break;
                    case "tabC":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjLnkCompApply/prjCompApplyProcessPage.do?linkId=" + lnkCompId + "&&isLnkCompFlag=0" + "&isLnkPrjViewFlag=1");
                        break;
                    case "tabD":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjLnkCompBkAcc/toListPageDetail.do?compId=" + lnkCompId);
                        break;
                    case "tabE":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstManualRelation/toListPage.do?Id=" + lnkCompId + "&useType=3&cstType=2");
                        break;
                    case "tabF":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjlnkcomp/toThreeDataPage.do?lnkId=" + lnkCompId + "&saveBizFlowRl=" + '${saveBizFlowRl}' + "&isWarnCheck=" + '${isWarnCheck}' + "&isRiskWarnFlow=" + '${isRiskWarnFlow}');
                        break;
                    case "tabG":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjlnkcomp/toOldFilesListPage.do?id=" + lnkCompId);
                        break;
                    case "tabM":
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/splCap/capPrjAr/toCapPrjArListPage.do?dataId=" + lnkCompId + "&type=3" );
                        break;
                }
                //     };
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
        if (buOrgCd != ProjectConstant.CODE_BU_ORG_CD_CAR) {

            $("#tabDId").hide();
        }
        if ($('#isShowThreeDataPage').length <= 0) {
            pageInTab.removeTabItem("tabF");
        }
        if ($('#isShowPrjArPage').length <= 0) {
            pageInTab.removeTabItem("tabM");
        }

    };

    //初始化Tab
    function initZKTab() {
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            /*          onBeforeSelectTabItem: function (tabid) {
                         var lnkCompId = $("#lnkCompId").val();
                          if(tabid!="tabA"){
                                 if(pageInApp.flag){
                                    top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                                    return false;
                                }
                         }
                     }, */
            onAfterSelectTabItem: function (tabid) {
                //   if (loadedTabs.indexOf(tabid)<0) {
                var lnkCompId = $("#lnkCompId").val();
                if (tabid != "tabA") {
                    if (lnkCompId == null || lnkCompId == '') {
                        top.$.ligerDialog.SQalert({content: LogUtils.LOG_LNK_COMP_SELECT_BEFORE, SQ_type: "warning"});
                        return false; //验证不通过，不执行以下代码
                    }
                }
                loadedTabs.push(tabid);
                switch (tabid) {
                    case "tabB":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/project/prjbscinfo/toPrjBscInfoListPage.do?lnkCompId=" + lnkCompId);
                        break;
                    case "tabB":
                        var lnkCompId = $("#lnkCompId").val();
                        pageInTab.setTabItemSrc(tabid, "<%=path%>/bizflow/sysBizFlowRl/toAddPage.do?saveBizFlowRl=${saveBizFlowRl}&tabNm=PRJ_LNK_COMP&codeGrpCd=FLW0001&dataId=" + lnkCompId);
                        break;
                }
                //     };
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
        if (buOrgCd != ProjectConstant.CODE_BU_ORG_CD_CAR) {

            $("#tabDId").hide();
        }
    };

    //设置页面数据
    function setData(data) {
    	var form = liger.get("formSet1");
    	form.setData({
    		isUploadLoa:data.isUploadLoa,
    		isRecycleLoa:data.isRecycleLoa
    	});
        $("#lnkCompNm").html(data.lnkCompNm);//公司名称
        $("#ownerCdNm").html(data.ownerCdNm);//公司归属
        $("#officeAddr").html(data.officeAddr);//所在地
        $("#majorBiz").html(data.majorBiz);//主营项目类别
        $("#compTyp").html(data.compTyp);//企业类型
        $("#bizLicNo").html(data.bizLicNo);//营业执照注册号
        $("#succ").html(data.succ);//统一社会信用代码
        $("#regAddr").html(data.regAddr);//注册地址
        $("#taxRegNo").html(data.taxRegNo);//税务登记号
        $("#orgCode").html(data.orgCode);//组织机构代码
        $("#bizScope").html(data.bizScope);//经营范围
        $("#corpRep").html(data.corpRep);//法人代表
        $("#idNo").html(data.idNo);//法人身份证号
        $("#totLnkQty").html(data.totLnkQty);//现累计挂靠数量
        $("#ownQty").html(data.ownQty);//自有车辆备案数量
        $("#ourTotLnkQyt").html(data.ourTotLnkQyt);//在我司累积挂靠车辆
        $("#suppLnkPrjTypCd").html(data.suppPrjTypCdNm);//可支持挂靠项目类型
        $("#isUploadLoaNm").html(data.isUploadLoaNm);//三方授权书是否上传
        $("#isRecycleLoaNm").html(data.isRecycleLoaNm);//三方授权书是否回收
        $("#lnkNm").html(data.lnkNm);//联系人
        $("#lnkMp").html(data.lnkMp);//联系人手机号码
        $("#actCtrlNm").html(data.actCtrlNm);//实际控制人
        $("#actCtrlMp").html(data.actCtrlMp);//实际控制人手机号码
        $("#lnkPost").html(data.lnkPost);//联系人职务
        $("#audStsCdNm").html(data.audStsCdNm);//审核状态
        $("#rem").text(data.rem == null ? "" : data.rem);//备注
        $("#orgCode").text(data.orgCode);//组织机构代码
        $("#rgnNms").text(data.rgnNms)
        $("#dataFromNm").text(data.dataFromNm)
        if (data.expDt) {
            var expDt = DateUtils.formatDate(new Date(data.expDt), DateUtils.YYYY_MM_DD);
            $("#expDt").html(expDt);//道路运输许可证有效期
        }
        if (data.regDt) {
            var regDt = DateUtils.formatDate(new Date(data.regDt), DateUtils.YYYY_MM_DD);
            $("#regDt").html(regDt);//注册日期
        }

        //项目发起人信息
        $("#startPrjCstMgrNm").html(data.startPrjCstMgrNm);
        $("#startPrjCstMgrTel").html(data.startPrjCstMgrTel);
        $("#startPrjCstMgrOrgCdNm").html(data.startPrjCstMgrOrgNm);
        $("#isUploadLoaNm").html(data.isUploadLoaNm);
        $("#isRecycleLoaNm").html(data.isRecycleLoaNm);
    };

    function initRlPsnGrid() {
        var _lnkCompId = $("#lnkCompId").val();
        var _audStsCd =${isCheck}
        if (!lnkCompId) {
            return;
        }
        rlPsnGrid = $("#ligergrid_psn").ligerGrid({
            usePager: false,
            url: '<%=path%>/project/prjLnkCompRlPsn/initList.do?prjLnkCompId=' + _lnkCompId+'&isMask='+isMask,
            method: 'get',
            columns: [
                {display: '姓名(*)', name: 'rlNm', minWidth: 60},
                {display: '联系人类型(*)', name: 'rlTypCdNm', minWidth: 60},
                {display: '股比',name:'stockRatio',width:100},
                {display: '证件类型(*)', name: 'certTypCdNm', minWidth: 60},
                {
                    display: '关联公司', name: 'rlNm', minWidth: 60,
                    render: function (rowdata, rowindex, value) {
                        return '<a href="javascript:toRlEntPage(\'' + value + '\');" class="sq-button-hasicon"><i class="sqBtnIco_1"></i></a>';
                    }
                },
                {
                    display: '证件号码(*)', name: 'certNo', width: 140, align: 'left',
                    render: function (rowdata, rowindex, value) {
                        if (value != null && value != '') {
                            return '<a href="javascript:toCertNoCheckPage(\'' + value + '\');" class="sq-button-hasicon link">'
                                + '<i class="sqBtnIco_1"></i></a>'
                                + value;
                        }
                    }
                },
                {display: '联系电话(*)', name: 'tel', width: 100, align: 'left'},
                {display: '备注', name: 'rlRem', minWidth: 140},
                {
                    display: '工商信息校验', name: 'checkVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.busInfoVerify == 2 || rowdata.busInfoVerify == null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(1,\'' + rowdata.id + '\',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                {
                    display: '工商信息校验结果', name: 'busInfoVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.busInfoVerify == 1) {
                            return "一致";
                        } else if (rowdata.busInfoVerify == -1) {
                            return "不一致";
                        } else if (rowdata.busInfoVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构1）', name: 'PYCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {

                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.pyPerVerify == 2 || rowdata.pyPerVerify == null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(2,\'' + rowdata.id + '\',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果1', name: 'pyPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.pyPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.pyPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.pyPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构2）', name: 'TDCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.tdPerVerify == 2 || rowdata.tdPerVerify == null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"

                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(3,\'' + rowdata.id + '\',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<div class="sq-button sq-button-round disabled">已校验</div>'
                            }
                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果2', name: 'tdPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.tdPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.tdPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.tdPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
                {
                    display: '三要素校验（机构3）', name: 'BRCheck', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        var h = "";
                        if (_audStsCd == 1) {
                            if (rowdata.brPerVerify == 2 || rowdata.brPerVerify == null) {
                                //h += "<a  href = "javascript:checkRlPsn('Verify',\''+rowdata.id+'\',\''+rowdata.rlNm+'\',\''+rowdata.certNo+'\',\''+rowdata.tel+'\');" class = "sq-button sq-button-round">验证</a>"
                                h += '<a class="sq-button sq-button-round" href="javascript:checkRlPsn(4,\'' + rowdata.id + '\',\'' + rowdata.rlNm + '\',\'' + rowdata.certNo + '\',\'' + rowdata.tel + '\',\'' + rowdata.rlTypCd + '\');">验证</a>'
                            } else {
                                h += '<input class="sq-button sq-button-round disabled" type="button" value="已校验" disabled>'
                            }
                        }
                        return h;
                    }
                },
                {
                    display: '三要素校验结果3', name: 'brPerVerify', minWidth: 150,
                    render: function (rowdata, rowindex, value) {
                        if (rowdata.brPerVerify == 1) {
                            return "一致";
                        } else if (rowdata.brPerVerify == -1) {
                            return "不一致";
                        } else if (rowdata.brPerVerify == 0) {
                            return "未查得";
                        } else {
                            return "";
                        }
                    }
                },
            ],
            pageSize: 100,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            heightDiff: -2,
            checkbox: false,
            enabledEdit: false,
            allowUnSelectRow: true,
            alternatingRow: false,
            rownumbers: true,
            enabledSort: false,
            usePagerOnLessPagesize: false,
        });
        rlPsnGrid.setHeight(200);
    }

    // 跳转到证件号查重页面
    function toCertNoCheckPage(certNo) {
        Add_navTab('tab_cert_no_check', '证件号查重页面', '<%=path%>/spl/cstRelInfoView/toCstRelInfoView.do?certNo=' + certNo);
    }

    // 跳转到关联公司页面
    function toRlEntPage(_name) {
        var params = '';
        params += 'name=' + _name;
        params += '&entname=' + $('#lnkCompNm').text();
        Add_navTab('tab_rl_ent_page' + _name, '关联公司', '<%=path%>/splExecRypossha/toListPage.do?' + params);
    }

    function relationshipsView() {
        var org_cd = $("#succ").html();
        var currentUserId = '${currentUserId}'
        if (!org_cd) {
            $.ligerDialog.SQalert({content: "社会同一信用代码为空！", SQ_type: "warning"});
            return false;
        }
        Add_navTab('tab_relationships_view_data' + id + '1', '集团关联图谱', '<%=path%>/knowledgeGraph/init/initGraphGroupPage.do?org_code=' + org_cd+'&usrId='+currentUserId);
    }

    function checkRlPsn(type, dataId, rlNm, certNo, tel, rlTypCd) {
        var _type;
        if (type == 1) {
            _type = 'verify';
        }
        if (type == 2) {
            _type = 'PY';
        }
        if (type == 3) {
            _type = 'TD';
        }
        if (type == 4) {
            _type = 'BR';
        }
        var _lnkCompId = $("#lnkCompId").val();
        var _url = '<%=path%>/project/prjLnkCompRlPsn/checkRlPsn.do';
        $.ajax({
            type: 'post',
            dataType: 'json',
            data: {
                type: _type,
                dataId: dataId,
                rlNm: rlNm,
                certNo: certNo,
                tel: tel,
                compId: _lnkCompId
            },
            url: _url,
            success: function (msg) {
                if (msg.success == 1) {
                    //alert(msg.info)
                    initRlPsnGrid();

                } else {
                    //$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
                    initRlPsnGrid();
                }
            }
        });
    }

    // 跳转注册地址查重页
    function toRegAddrList() {
        var regAddr = $("#regAddr").text();
        if (StringUtils.isEmpty(regAddr)) {
            $.ligerDialog.SQalert({content: "注册地址信息为空，不支持查询!", SQ_type: "warning"});
            return;
        }
        Add_navTab('tab_re_mgr_prj', '查重页面', '<%=path%>/spl/regAddrRel/toRegAddrList.do?addr=' + regAddr);
    };

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && ''!= value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>
</body>
</html>
